/*
 * Copyright 2018 Zhongan.com All right reserved. This software is the
 * confidential and proprietary information of Zhongan.com ("Confidential
 * Information"). You shall not disclose such Confidential Information and shall
 * use it only in accordance with the terms of the license agreement you entered
 * into with Zhongan.com.
 */

package com.zhongan.cloud.gateway.route;

import org.springframework.cloud.gateway.route.RouteLocator;
import org.springframework.cloud.gateway.route.builder.RouteLocatorBuilder;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 权重路由
 *
 * @author tongyufu
 * @since 2018年9月25日 下午5:58:29
 */
//@Configuration
public class WeightRoute {

    @Bean
    public RouteLocator weightRouteLocator(RouteLocatorBuilder builder) {
        return builder.routes()
                .route(r -> r.path("/weight").and().weight("weight1", 60).uri("http://localhost:8090/weight/v1"))
                .route(r -> r.path("/weight").and().weight("weight1", 40).uri("http://localhost:8090/weight/v2"))
                .build();
    }
}
